package com.example.patient.controller;

import com.example.common.support.Result;
import com.example.patient.dto.resp.OrderInfoResp;
import com.example.patient.dto.resp.OrderPayResp;
import com.example.patient.service.PayService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Author wxy
 * @Date 2021/1/18 9:46
 * @Version 1.0
 */
@RestController
@Api(tags = "发起支付")
@RequestMapping("/Wx/Pay")
public class PayController {
    @Resource
    private PayService payService;

    @ApiOperation(value = "订单详情", notes = "订单详情")
    @GetMapping(value = "/orderInfo")
    public Result<OrderInfoResp> orderInfo(@RequestParam(value = "OrderNo") String orderNo,
                                           @RequestParam(value = "oType") Integer oType) {
        return Result.success(payService.orderInfo(orderNo, oType));
    }

    @ApiOperation(value = "发起支付", notes = "发起支付")
    @GetMapping(value = "/orderPay")
    public Result<OrderPayResp> orderPay(@RequestParam(value = "OrderNo") String OrderNo,
                                         @RequestParam(value = "oType") Integer oType,
                                         @RequestParam(value = "wapay") String wapay) {
        return Result.success(payService.orderPay(OrderNo, oType, wapay));
    }
}
